﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imaginecup.gameState.malaria.componentInit;
using imaginecup.information;
using imaginecup.objectManager;
using imaginecup.util;
using Microsoft.Xna.Framework;

namespace Imaginecup.gameState.malaria.component.entity.item
{
    public abstract  class BaseItemEntityComponent : BaseEntityComponent, ICmpItem
    {
        protected bool m_bSelectItem = false;

        public BaseItemEntityComponent(GObjectID a_GID, ObjectManager objMan, SComponentTypeID componentTypeID)
            : base(a_GID, objMan, componentTypeID)
        {


        }

        public override EMessageResult HandleMessage(GMessage a_Msg)
        {
            return base.HandleMessage(a_Msg);
        }

        public virtual bool IsUseAble()
        {
            return true;
        }

        public virtual void DisableItem()
        {
            m_bSelectItem = false;
        }

        protected void RenderOn()
        {
            IComponent render = m_ObjectMan.QueryInterface(m_ObjectID, SInterfaceID.IID_RENDER);
            if (render == null) return;
            render.SetCmpEnable(true);
        }
        protected void RenderOff()
        {
            IComponent render = m_ObjectMan.QueryInterface(m_ObjectID, SInterfaceID.IID_RENDER);
            if (render == null) return;
            render.SetCmpEnable(false);
        }

        public abstract void UseItem(GameTime gameTime);
        public virtual bool IsStateEnd()
        {
            return false;
        }

        public virtual double GetCoolTimeRate()
        {
            return 1;
        }

        public virtual bool IsSelectAble()
        {
            return true;
        }

        public void SelectItem()
        {
            m_bSelectItem = true;
        }
    }
}
